﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace IMIS_ERP.Web.Factory_People
{
    public partial class Modify_Me : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                string fpID = Session["UId"].ToString();
                ShowInfo(fpID);

              
            }
        }

        /// <summary>绑定数据：详细信息
        ///     <remarks>2010-12-08 河大信管团队</remarks>
        /// </summary>
        /// <param name="fpID">编号</param>
        private void ShowInfo(string fpID)
        {
            IMIS_ERP.BLL.Factory_People bll = new IMIS_ERP.BLL.Factory_People();
            IMIS_ERP.Model.Factory_People model = bll.GetModel(fpID);
            this.lblfpID.Text = model.fpID;
            this.lblfpName.Text = model.fpName;
            //this.txtfpPwd.Text=model.fpPwd;
            this.txtfpContacts.Text = model.fpContacts;

            // fixed 2010 12 15 修改员工类型
            this.lblfpType.Text = (model.fpType);
            this.lblfpFiID.Text = model.fpFiID;
            this.txtfpInfo.Text = model.fpInfo;

        }

        public void btnSave_Click(object sender, EventArgs e)
        {


            IMIS_ERP.Model.Factory_People model = new IMIS_ERP.Model.Factory_People();
            model.fpID = this.lblfpID.Text.Trim();
            model.fpName = this.lblfpName.Text;
            model.fpPwd = "";
            model.fpContacts = this.txtfpContacts.Text;
            // fixed 2010 12 15 员工类型
            model.fpType = this.lblfpType.Text;
            model.fpFiID = this.lblfpFiID.Text;
            model.fpInfo = this.txtfpInfo.Text;

            IMIS_ERP.BLL.Factory_People bll = new IMIS_ERP.BLL.Factory_People();
            if (bll.Update(model))
            {
                lblMessage.Text = "修改信息成功";
            }
            else
            {
                lblMessage.Text = "修改信息失败,请重试";
            }

        }
    }
}